﻿namespace 个人博客.SqlViews
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;

    public partial class Model1 : DbContext
    {
        public Model1()
            : base("name=Model12")
        {
        }

        public virtual DbSet<Blogs_Account> Blogs_Account { get; set; }
        public virtual DbSet<Blogs_Jurisdiction> Blogs_Jurisdiction { get; set; }
        public virtual DbSet<Blogs_page> Blogs_page { get; set; }
        public virtual DbSet<Blogs_personalInformation> Blogs_personalInformation { get; set; }
        public virtual DbSet<Blogs_reply> Blogs_reply { get; set; }
        public virtual DbSet<Blogs_talk> Blogs_talk { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Blogs_Account>()
                .Property(e => e.acc_gmail)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_Account>()
                .Property(e => e.acc_pwd)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_Account>()
                .Property(e => e.acc_name)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_Account>()
                .HasMany(e => e.Blogs_Jurisdiction)
                .WithOptional(e => e.Blogs_Account)
                .HasForeignKey(e => e.jur_number);

            modelBuilder.Entity<Blogs_Account>()
                .HasMany(e => e.Blogs_personalInformation)
                .WithOptional(e => e.Blogs_Account)
                .HasForeignKey(e => e.per_number);

            modelBuilder.Entity<Blogs_Account>()
                .HasMany(e => e.Blogs_reply)
                .WithOptional(e => e.Blogs_Account)
                .HasForeignKey(e => e.rep_userNumber);

            modelBuilder.Entity<Blogs_Account>()
                .HasMany(e => e.Blogs_talk)
                .WithOptional(e => e.Blogs_Account)
                .HasForeignKey(e => e.tal_userNumber);

            modelBuilder.Entity<Blogs_Jurisdiction>()
                .Property(e => e.jur_banned)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_page>()
                .Property(e => e.pag_name_CH)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_page>()
                .Property(e => e.pag_name_file)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_personalInformation>()
                .Property(e => e.per_name)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_personalInformation>()
                .Property(e => e.per_sex)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_personalInformation>()
                .Property(e => e.per_phone)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_personalInformation>()
                .Property(e => e.per_gmail)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_personalInformation>()
                .Property(e => e.per_birthday)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_personalInformation>()
                .Property(e => e.per_site)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_reply>()
                .Property(e => e.rep_content)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_reply>()
                .Property(e => e.rep_time)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_talk>()
                .Property(e => e.tal_content)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_talk>()
                .Property(e => e.tal_time)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_talk>()
                .Property(e => e.tal_top)
                .IsUnicode(false);

            modelBuilder.Entity<Blogs_talk>()
                .HasMany(e => e.Blogs_reply)
                .WithOptional(e => e.Blogs_talk)
                .HasForeignKey(e => e.rep_replyId);
        }
    }
}
